import requests
import os
from datetime import datetime
from bs4 import BeautifulSoup

url = 'https://bc-onlinestore.com/c/corabo/corabo_HQ/corabo_HQ_CB/corabo_HQ_CB_s_k_d/4580689592769'
response = requests.get(url)
if response.status_code != 200:
    exit()

soup = BeautifulSoup(response.text,'html.parser')
div_element = soup.find(id='fs_productCarouselMainImage')
# print(div_element)
img_srcs = [img['src'].split("?t")[0]  for img in div_element.find_all('img')]

for url in urlArr:
    splitted = url.split('/')
    filename = splitted[len(splitted)-1]
    response = requests.get(url)
    if response.status_code == 200:
        with open(os.path.join(save_dir, filename), "wb") as f:
            f.write(response.content)
        print("图片下载成功:", filename)
    else:
        print("图片下载失败")

print(img_srcs)
# a_href = a_tag['href']
# a_href_arr = a_href.split("/")